//
//  AudioRecorderView.h
//  录音播放组件-支持录音和播放按钮为同一按钮或分别为不同按钮
//  用法：1.初始化组件并加入视图  AudioRecorderView *audioRecorderView = [AudioRecorderView instanceWithFrame:[AppUtils getScreenBounds] existRecordButton:self.voiceButton existPlayButton:self.testButton];
//  [self.view addSubview:audioRecorderView];
//  2.使用的Controller自行代理AudioRecorderDelegate来处理按钮样式变化
//
//  Created by 张进 on 15/8/3.
//  Copyright (c) 2015年 张进. All rights reserved.
//

#import <UIKit/UIKit.h>

@protocol AudioRecorderDelegate;

@interface AudioRecorderView : UIView

@property (weak, nonatomic) IBOutlet UIView *backgoundView;
@property (weak, nonatomic) IBOutlet UIImageView *imageView;
@property (weak, nonatomic) IBOutlet UILabel *descLabel;

@property (weak, nonatomic) id<AudioRecorderDelegate> delegate;

+(AudioRecorderView *)instanceWithFrame:(CGRect)rect existRecordButton:(UIButton *)recordButton existPlayButton:(UIButton *)playButton;

/**
 *  删除录音
 */
-(void)deleteRecord;
/*
 *  暂停播放录音
 */
-(void)playerPause;

@end

@protocol AudioRecorderDelegate <NSObject>

@optional
-(void)recorderDidStartRecording;
-(void)recorderDidCancelRecording;
-(void)recorderDidFinishRecording:(NSTimeInterval)timeInterval;
-(void)recorderEncodeErrorDidOccur:(NSError *)error;

-(void)playerDidStartPlaying;
-(void)playerDidPausePlaying;
-(void)playerDidContinuePlaying;
-(void)playerDidFinishPlaying;
-(void)playerDecodeErrorDidOccur:(NSError *)error;

-(void)recordingHasDeleted;

@end